package com.yiwyn.demo.controller;

import com.yiwyn.demo.publish.RedisMQPublish;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class RedisMQController {
    @Autowired
    private RedisMQPublish redisMQPublish;


    @GetMapping("/push")
    public String push() {
        redisMQPublish.publishMsg("测试消息");
        return "发送成功";
    }

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @GetMapping("/ppush")
    public String ppush() {
        redisTemplate.convertAndSend("test.queue.test", "模式消息");
        return "发送成功";
    }


}
